function a(a, t, e) {
    return t in a ? Object.defineProperty(a, t, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : a[t] = e, a;
}

var t, e, o = require("../../wxParse/wxParse.js"), i = require("../../utils/api.js"), s = require("../../utils/disapi.js"), d = getApp();

Page((e = {
    data: (t = {
        page: !1,
        goodsIndex: 1,
        banners: [],
        estimate: "2018-10-28 18:00:000",
        actEndTime: "",
        info: {
            g_has_option: 0
        },
        article: "",
        items: {},
        bought_img: [],
        show: !1,
        choose: {
            img: "",
            num: "1",
            ptype: [ {
                id: "1",
                name: "2斤装"
            }, {
                id: "2",
                name: "3斤装"
            }, {
                id: "3",
                name: "5斤装两个"
            } ]
        },
        curOrderStatus: "",
        format: "规格",
        carnum: "",
        share: !1,
        buy: "立即购买",
        all: !1,
        at_id: "",
        addstatus: !0,
        title: "",
        stickyFlag: !1,
        tabCur: 0
    }, a(t, "at_id", ""), a(t, "head", []), a(t, "member", []), a(t, "showTop", !0), 
    a(t, "groupBuyShow", !1), a(t, "showLoding", !0), a(t, "default_big_img", d.globalData.default_big_img), 
    a(t, "playBtn", "/images/playvideo.png"), a(t, "showposter", !0), a(t, "showyouhui", !1), 
    a(t, "WeixinPosterBg", ""), a(t, "posterBg", ""), a(t, "saveImg", !1), a(t, "imgHeights", []), 
    a(t, "cur", 0), a(t, "showSuccesstipInfo", {
        showSuccesstip: !0,
        title: "已加入购物车",
        type: !0
    }), a(t, "canvasHidden", !1), a(t, "autoplay", !0), a(t, "showVideo", !1), a(t, "closeList", !1), 
    a(t, "maxshow", 3), a(t, "spShow", !1), a(t, "limitTips", {
        title: "",
        duration: 2e3,
        show: !1
    }), t),
    onLoad: function(a) {
        var t = this, a = a;
        if (d.globalData.openid) {
            if (console.log(a), a.scene) s = a.scene.split("#")[2];
            if (a.mid) s = a.mid;
            if (s) {
                var e = {
                    openid: d.globalData.openid,
                    head_mid: s
                };
                i.selectShareHead(e).then(function(a) {
                    console.log(a), 0 == a.errno && t.setData({
                        head: a.data
                    });
                });
            }
            t.loads(a);
        } else if (console.log(a), a.scene) var o = decodeURIComponent(a.scene), s = o.split("#")[2] || a.scene.split("#")[2], n = (o.split("#")[3] || a.scene.split("#")[3], 
        setInterval(function() {
            if (console.log(d.globalData.openid), d.globalData.openid) {
                clearInterval(n);
                var e = {
                    openid: d.globalData.openid,
                    head_mid: s
                };
                i.selectShareHead(e).then(function(a) {
                    console.log(a), 0 == a.errno && t.setData({
                        head: a.data
                    });
                }), i.getMember({
                    openid: d.globalData.openid
                }).then(function(e) {
                    if (console.log(e), 0 != e.errno || null == e.data.m_nickname || "" == e.data.m_nickname || "null" == e.data.m_nickname || void 0 == e.data.m_nickname) {
                        if (o.split("#")[6] && "seckill" == o.split("#")[6]) i = t.route + "?scene=" + o.split("#")[0] + "#" + o.split("#")[1] + "#" + o.split("#")[2] + "#" + o.split("#")[3] + "#" + o.split("#")[4] + "#" + o.split("#")[5] + "#" + o.split("#")[6]; else var i = t.route + "?scene=" + o.split("#")[0] + "#" + o.split("#")[1] + "#" + o.split("#")[2] + "#" + o.split("#")[3];
                        i = encodeURIComponent(i), console.log(i), wx.reLaunch({
                            url: "/pages/authorization/authorization?url=" + i
                        });
                    } else t.loads(a);
                });
            } else ;
        }, 100)); else if (a.mid) var s = a.mid, n = setInterval(function() {
            if (console.log(d.globalData.openid), d.globalData.openid) {
                clearInterval(n);
                var e = {
                    openid: d.globalData.openid,
                    head_mid: s
                };
                i.selectShareHead(e).then(function(a) {
                    console.log(a), 0 == a.errno && t.setData({
                        head: a.data
                    });
                }), i.getMember({
                    openid: d.globalData.openid
                }).then(function(e) {
                    if (console.log(e), 0 != e.errno || null == e.data.m_nickname || "" == e.data.m_nickname || "null" == e.data.m_nickname || void 0 == e.data.m_nickname) {
                        if ("seckill" == a.resource) o = t.route + "?gid=" + a.gid + "&&actEndTime=" + a.actEndTime + "&&p_id=" + a.p_id + "&&timeid=" + a.timeid + "&&roomid=" + a.roomid + "&&taskid=" + a.taskid + "&&resource=seckill&&startTime=" + a.startTime + "&&mid=" + a.mid; else var o = t.route + "?id=" + a.id + "&&at_id=" + a.at_id + "&&actEndTime=" + a.actEndTime + "&&p_id=" + a.p_id + "&&mid=" + a.mid;
                        o = encodeURIComponent(o), console.log(o), wx.reLaunch({
                            url: "/pages/authorization/authorization?url=" + o
                        });
                    } else t.loads(a);
                });
            } else ;
        }, 100); else t.loads(a);
    },
    loads: function(a) {
        var t = this;
        console.log(a);
        var e = void 0, n = void 0, l = void 0, r = void 0, c = void 0, g = void 0, u = void 0, p = void 0, m = void 0;
        if (t.setData({
            showLoding: !1
        }), wx.getSystemInfo({
            success: function(a) {
                console.log(a), t.setData({
                    systemWidth: a.screenWidth,
                    systemHeight: a.screenHeight
                });
            }
        }), t.setData({
            default_img_small: d.globalData.default_small_img,
            default_img_big: d.globalData.default_big_img,
            is_open_video: d.globalData.is_open_goods_video,
            is_open_spike: d.globalData.is_open_spike,
            openid: d.globalData.openid
        }), a.scene) {
            var _ = decodeURIComponent(a.scene);
            console.log(_), "seckill" == a.resource || "seckill" == _.split("#")[6] ? (console.log(1), 
            e = _.split("#")[0], p = _.split("#")[1], r = _.split("#")[2], c = _.split("#")[3], 
            u = _.split("#")[4], g = _.split("#")[5], m = _.split("#")[6]) : (e = _.split("#")[0], 
            n = _.split("#")[1], r = _.split("#")[2], c = _.split("#")[3]);
        } else "seckill" == a.resource || "seckill" == m ? (console.log(a), e = a.gid ? a.gid : "", 
        c = a.p_id ? a.p_id : "", l = a.mid ? a.mid : "", g = a.timeid ? a.timeid : "", 
        u = a.taskid ? a.taskid : "", p = a.roomid ? a.roomid : "", console.log(22)) : (e = a.id ? a.id : "", 
        n = a.at_id ? a.at_id : "", c = a.p_id ? a.p_id : "", a.actEndTime ? a.actEndTime : "", 
        l = a.mid ? a.mid : "", console.log(33));
        if ("" != c && void 0 != c) {
            console.log(44);
            var h = d.globalData.openid;
            void 0 == h || "" == h ? wx.login({
                success: function(a) {
                    if (a.code) {
                        var e, o;
                        i.getOpenid({
                            code: a.code
                        }).then(function(a) {
                            wx.setStorage({
                                key: "openid",
                                data: a.data.openid
                            }), wx.setStorage({
                                key: "sessionkey",
                                data: a.data.sessionkey
                            }), e = a.data.openid, t.setData({
                                openid: e
                            }), o = a.data.sessionkey, s.get_group_bing({
                                openid: e,
                                pid: c
                            }).then(function(a) {
                                console.log(a);
                            });
                        });
                    } else console.log("授权失败");
                }
            }) : s.get_group_bing({
                openid: h,
                pid: c
            }).then(function(a) {
                console.log(a);
            });
        }
        if (console.log(r), "seckill" == a.resource || "seckill" == m) {
            if ("" != r && void 0 != r && (d.globalData.share_mid = r, d.globalData.share_url = "/pages/goods/goodsDetail?id=" + e + "&timeid=" + g + "&roomid=" + p + "&taskid=" + u + "&resource=seckill"), 
            "" != l && void 0 != l && (d.globalData.share_mid = l, d.globalData.share_url = "/pages/goods/goodsDetail?id=" + e + "&timeid=" + g + "&roomid=" + p + "&taskid=" + u + "&resource=seckill"), 
            "" == l && "" != e && (d.globalData.share_url = "/pages/goods/goodsDetail?id=" + e + "&timeid=" + g + "&roomid=" + p + "&taskid=" + u + "&resource=seckill"), 
            "" != wx.getStorageSync("head_info") && void 0 != wx.getStorageSync("head_info") || i.getTeamOpenid({
                openid: d.globalData.openid
            }).then(function(a) {
                if ("" == a.data.user.m_head_openid) {
                    console.log(12222);
                    var t = {
                        openid: wx.getStorageSync("openid"),
                        head_mid: d.globalData.share_mid
                    };
                    i.selectShareHead(t).then(function(a) {
                        console.log(a), 0 == a.errno && wx.setStorage({
                            key: "head_info",
                            data: a.data
                        });
                    });
                }
            }), console.log(wx.getStorageSync("head_info").m_id), void 0 != wx.getStorageSync("head_info").m_id && "" != wx.getStorageSync("head_info").m_id && wx.getStorageSync("head_info").m_id != d.globalData.share_mid && "" != d.globalData.share_mid && void 0 != d.globalData.share_mid) {
                f = {
                    openid: wx.getStorageSync("openid"),
                    head_mid: d.globalData.share_mid
                };
                i.selectShareHead(f).then(function(a) {
                    if (console.log(a), 0 == a.errno) {
                        wx.setStorageSync({
                            key: "head_info",
                            data: a.data
                        });
                        wx.getStorageSync("head_info");
                        t.setData({
                            items: a.data
                        });
                    }
                });
            }
            i.seeTitleSet().then(function(a) {
                1 == a.errno && "" != a.data.index_title && a.data && t.setData({
                    title: a.data.index_title
                });
            }), 0 == wx.getStorageSync("cartnum") ? t.setData({
                carnum: ""
            }) : t.setData({
                carnum: wx.getStorageSync("cartnum")
            });
        } else {
            if ("" != r && void 0 != r && (console.log(55), d.globalData.share_mid = r, d.globalData.share_url = "/pages/goods/goodsDetail?id=" + e + "&at_id=" + n), 
            "" != l && void 0 != l && (console.log(66), d.globalData.share_mid = l, d.globalData.share_url = "/pages/goods/goodsDetail?id=" + e + "&at_id=" + n), 
            "" == l && "" != e && (console.log(77), console.log(1), d.globalData.share_url = "/pages/goods/goodsDetail?id=" + e), 
            "" != wx.getStorageSync("head_info") && void 0 != wx.getStorageSync("head_info") || (console.log(66), 
            i.getTeamOpenid({
                openid: d.globalData.openid
            }).then(function(a) {
                if ("" == a.data.user.m_head_openid) {
                    console.log(122222);
                    var t = {
                        openid: wx.getStorageSync("openid"),
                        head_mid: d.globalData.share_mid
                    };
                    i.selectShareHead(t).then(function(a) {
                        console.log(a), 0 == a.errno && wx.setStorage({
                            key: "head_info",
                            data: a.data
                        });
                    });
                }
            })), console.log(wx.getStorageSync("head_info").m_id), "" != wx.getStorageSync("head_info").m_id && void 0 != wx.getStorageSync("head_info").m_id && wx.getStorageSync("head_info").m_id != d.globalData.share_mid && "" != d.globalData.share_mid && void 0 != d.globalData.share_mid) {
                console.log(99);
                var f = {
                    openid: wx.getStorageSync("openid"),
                    head_mid: d.globalData.share_mid
                };
                i.selectShareHead(f).then(function(a) {
                    if (console.log(a), 0 == a.errno) {
                        wx.setStorageSync({
                            key: "head_info",
                            data: a.data
                        });
                        wx.getStorageSync("head_info");
                        t.setData({
                            items: a.data
                        });
                    }
                });
            }
            i.seeTitleSet().then(function(a) {
                1 == a.errno && "" != a.data.index_title && a.data && t.setData({
                    title: a.data.index_title
                });
            }), 0 == wx.getStorageSync("cartnum") ? t.setData({
                carnum: "",
                at_id: n
            }) : t.setData({
                carnum: wx.getStorageSync("cartnum"),
                at_id: n
            });
        }
        if (wx.setNavigationBarColor({
            frontColor: wx.getStorageSync("basic").topcolor,
            backgroundColor: wx.getStorageSync("basic").topbg
        }), i.getGoodsInfoSet({
            openid: d.globalData.openid
        }).then(function(a) {
            console.log(a), t.setData({
                goods_info_action_price_bg: a.data.config.goods_info_action_price_bg.value,
                WeixinPosterBg: a.data.share_img,
                posterBg: a.data.share_playbill_img
            }), o.wxParse("severDes", "html", a.data.config.goods_info_sever_des.value, t, 5);
        }), "seckill" == a.resource || "seckill" == m) {
            if (console.log(a), a.scene) {
                w = {
                    taskid: u,
                    roomid: p,
                    timeid: g,
                    gid: e
                };
                console.log(w);
            } else {
                var w = {
                    taskid: a.taskid,
                    roomid: a.roomid,
                    timeid: a.timeid,
                    gid: a.id ? a.id : a.gid
                };
                console.log(w);
            }
            if (a.curGoodsType) if (a.curGoodsType && a.curGoodsType.indexOf("curgoods") >= 0) var D = "curgoods", x = a.actEndTime; else if (a.curGoodsType && a.curGoodsType.indexOf("aftergoods") >= 0) var D = "aftergoods", x = a.startTime; else if (a.curGoodsType && a.curGoodsType.indexOf("overgoods") >= 0) var D = "overgoods", x = a.actEndTime; else D = ""; else {
                var v = Date.parse(new Date()) / 1e3;
                if (v < a.startTime) var D = "aftergoods", x = a.startTime;
                if (v > a.startTime && v < a.actEndTime) var D = "curgoods", x = a.actEndTime;
                if (v > a.actEndTime) var D = "overgoods", x = a.actEndTime;
            }
            t.setData({
                mscur: D,
                parmas: w,
                endTime: x
            }), i.seckillGetGoods(w).then(function(e) {
                if (console.log(e), t.setData({
                    showLoding: !0,
                    spikeTime: e.data.time
                }), console.log(m), "seckill" == a.resource || "seckill" == m) {
                    var i = Date.parse(new Date()) / 1e3;
                    i < e.data.time.starttime && (console.log(e), t.setData({
                        endTime: e.data.time.starttime,
                        mscur: "aftergoods"
                    })), i > e.data.time.starttime && i < e.data.time.endtime && (console.log(e), t.setData({
                        endTime: e.data.time.endtime,
                        mscur: "curgoods"
                    })), i > e.data.time.endtime && (console.log(e), t.setData({
                        endTime: e.data.time.endtime,
                        mscur: "overgoods"
                    }));
                }
                console.log(t.data.endTime, t.data.mscur), wx.getImageInfo({
                    src: e.data.goods[0].g_icon,
                    success: function(a) {
                        console.log(a), wx.getImageInfo({
                            src: t.data.WeixinPosterBg,
                            success: function(e) {
                                t.drawweixinposter(a.path, e.path);
                            }
                        });
                    }
                }), console.log(f);
                for (var s in e.data.goods[0].buy_people) e.data.goods[0].buy_people[s].m_photo = e.data.goods[0].buy_people[s].m_photo.replace(/[\r\n]/g, "");
                t.setData({
                    resource: "spike",
                    seckill: 1,
                    oldshow: e.data.goods[0].oldshow,
                    startTime: a.startTime,
                    banners: e.data.goods[0].g_thumb,
                    info: e.data.goods[0],
                    article: e.data.goods[0].g_info,
                    bought_img: e.data.goods[0].buy_people ? e.data.goods[0].buy_people : "",
                    buy_people_num: e.data.goods[0].buy_people_num,
                    items: wx.getStorageSync("head_info"),
                    curGoodsNum: e.data.goods[0].curGoodsNum,
                    is_open_full_reduction: d.globalData.is_open_full_reduction,
                    full_reduction_price: d.globalData.full_reduction_price,
                    full_reduction_limit_price: d.globalData.full_reduction_limit_price,
                    "user_spike.seckill_img": e.data.seckill_img,
                    "user_spike.bg_color": e.data.bg_color
                });
                var n = {};
                n.title = t.data.info.g_name, n.img = t.data.banners[0], n.group = t.data.info.g_price, 
                n.retail = t.data.info.g_old_price, wx.setStorage({
                    key: "canvas_goods_data",
                    data: n
                }), wx.downloadFile({
                    url: "https:" + t.data.banners[0].split(":")[1],
                    success: function(a) {
                        wx.setStorage({
                            key: "img",
                            data: a.tempFilePath
                        });
                    }
                }), 0 == t.data.info.total && t.setData({
                    buy: "已售罄",
                    all: !0
                }), console.log(e.data.goods[0].g_info), o.wxParse("article", "html", e.data.goods[0].g_info, t, 5), 
                console.log(e.data.config.goods_info_sever_des.value);
            });
            b = {
                openid: d.globalData.openid,
                id: a.gid,
                actEndTime: a.actEndTime,
                taskid: a.taskid,
                roomid: a.roomid,
                timeid: a.timeid
            };
        } else {
            t.setData({
                endTime: a.actEndTime
            }), i.getGoods({
                gid: e,
                at_id: n,
                openid: d.globalData.openid
            }).then(function(a) {
                console.log(a.data[0]), t.setData({
                    showLoding: !0
                }), t.setData({
                    banners: a.data[0].g_thumb,
                    info: a.data[0],
                    article: a.data[0].g_info,
                    bought_img: a.data[0].buy_people ? a.data[0].buy_people : "",
                    buy_people_num: a.data[0].buy_people_num,
                    items: wx.getStorageSync("head_info"),
                    curGoodsNum: a.data[0].curGoodsNum,
                    endTime: a.data[0].action && a.data[0].action.at_end_time ? a.data[0].action.at_end_time : "",
                    is_open_full_reduction: d.globalData.is_open_full_reduction,
                    full_reduction_price: d.globalData.full_reduction_price,
                    full_reduction_limit_price: d.globalData.full_reduction_limit_price
                }), wx.getImageInfo({
                    src: a.data[0].g_icon,
                    success: function(a) {
                        console.log(a), wx.getImageInfo({
                            src: t.data.WeixinPosterBg,
                            success: function(e) {
                                t.drawweixinposter(a.path, e.path);
                            }
                        });
                    }
                }), console.log(t.data.full_reduction_price, t.data.full_reduction_limit_price);
                var e = {};
                e.title = t.data.info.g_name, e.img = t.data.banners[0], e.group = t.data.info.g_price, 
                e.retail = t.data.info.g_old_price, wx.setStorage({
                    key: "canvas_goods_data",
                    data: e
                }), wx.downloadFile({
                    url: "https:" + t.data.banners[0].split(":")[1],
                    success: function(a) {
                        wx.setStorage({
                            key: "img",
                            data: a.tempFilePath
                        });
                    }
                }), 0 == t.data.info.actual && t.setData({
                    buy: "已售罄",
                    all: !0
                }), console.log(a.data[0].g_info), o.wxParse("article", "html", a.data[0].g_info, t, 5), 
                console.log(a.data.config.goods_info_sever_des.value);
            });
            var b = {
                openid: d.globalData.openid,
                id: a.id,
                a_id: a.at_id,
                actEndTime: a.actEndTime
            };
        }
        t.setData({
            code: b
        }), i.getTeamOpenid({
            openid: d.globalData.openid
        }).then(function(o) {
            if (console.log(o), t.setData({
                head: o.data.head_info,
                member: o.data.user
            }), "seckill" == a.resource || "seckill" == m) s = t.data.parmas.gid + "#" + t.data.parmas.roomid + "#" + t.data.head.m_id + "#" + t.data.member.m_id + "#" + t.data.parmas.taskid + "#" + t.data.parmas.timeid + "#seckill"; else {
                console.log(t.data);
                var s = e + "#" + n + "#" + t.data.head.m_id + "#" + t.data.member.m_id;
            }
            console.log(s), i.getQRCodes({
                scene: s,
                url: "pages/goods/goodsDetail",
                openid: d.globalData.openid
            }).then(function(a) {
                console.log(a), 0 == a.errno ? wx.downloadFile({
                    url: a.data,
                    success: function(a) {
                        wx.setStorage({
                            key: "code",
                            data: a.tempFilePath
                        }), t.setData({
                            codeUrl: a.tempFilePath
                        });
                    }
                }) : wx.showToast({
                    title: a.message,
                    icon: "none",
                    duration: 2e3
                }), i.GoodsInfoRecommend({
                    gid: t.data.info.g_id,
                    openid: t.data.member.m_openid,
                    team_openid: t.data.head.m_openid
                }).then(function(a) {
                    for (var e = [], o = t.data.maxshow ? t.data.maxshow : 3, i = 0; i < a.data.data.length; i++) i < parseInt(o) && e.push(a.data.data[i]);
                    t.setData({
                        neighborGoods: e,
                        showNeighbor: a.data.is_open
                    }), console.log(t.data.neighborGoods);
                });
            });
        }), setTimeout(function() {
            console.log(t.data.info);
        }, 2e3), this.countDown();
    },
    scrollImagesChange: function(a) {
        console.log(a), this.setData({
            goodsIndex: a.detail.current + 1,
            cur: a.detail.current
        });
    },
    onCloseButton: function(a) {
        this.setData({
            specShow: !1
        });
    },
    onCloseButtons: function(a) {
        this.setData({
            show: !1
        });
    },
    modalChange: function() {
        this.setData({
            addstatus: !this.data.addstatus
        }), wx.reLaunch({
            url: "../cart/cart"
        });
    },
    modalCancel: function() {
        this.setData({
            addstatus: !this.data.addstatus
        });
    },
    share: function(a) {
        this.setData({
            share: !0
        });
    },
    shareClose: function() {
        this.setData({
            share: !1
        });
    },
    circle: function() {
        var a = this;
        wx.showLoading({
            title: "生成海报中",
            mask: !0
        }), a.setData({
            share: !1
        }), wx.getImageInfo({
            src: a.data.info.g_icon,
            success: function(t) {
                console.log(t), wx.getImageInfo({
                    src: a.data.posterBg,
                    success: function(e) {
                        console.log(e), a.drawposter(t.path, a.data.codeUrl, e.path);
                    }
                });
            }
        });
    },
    wechat: function() {
        wx.getShareInfo();
    },
    onShareAppMessage: function(a) {
        var t = this;
        return console.log(t.data.weixinShareImage), t.setData({
            share: !1
        }), console.log("/pages/goods/goodsDetail?gid=" + t.data.code.id + "&&actEndTime=" + t.data.code.actEndTime + "&&p_id=" + t.data.member.m_id + "&&timeid=" + t.data.code.timeid + "&&roomid=" + t.data.code.roomid + "&&taskid=" + t.data.code.taskid + "&&resource=seckill&&startTime=" + t.data.startTime + "&&mid=" + t.data.head.m_id), 
        console.log("/pages/goods/goodsDetail?id=" + t.data.code.id + "&&at_id=" + t.data.code.a_id + "&&actEndTime=" + t.data.code.actEndTime + "&&p_id=" + t.data.member.m_id + "&&mid=" + t.data.head.m_id), 
        console.log(a.target), "spike" == t.data.resource ? {
            title: t.data.info.g_name,
            path: "/pages/goods/goodsDetail?gid=" + t.data.code.id + "&&actEndTime=" + t.data.code.actEndTime + "&&p_id=" + t.data.member.m_id + "&&timeid=" + t.data.code.timeid + "&&roomid=" + t.data.code.roomid + "&&taskid=" + t.data.code.taskid + "&&resource=seckill&&startTime=" + t.data.startTime + "&&mid=" + t.data.head.m_id,
            imageUrl: t.data.weixinShareImage
        } : {
            title: t.data.info.g_name,
            path: "/pages/goods/goodsDetail?id=" + t.data.code.id + "&&at_id=" + t.data.code.a_id + "&&actEndTime=" + t.data.code.actEndTime + "&&p_id=" + t.data.member.m_id + "&&mid=" + t.data.head.m_id,
            imageUrl: t.data.weixinShareImage
        };
    },
    onPageScroll: function(a) {
        a.scrollTop <= 200 ? this.setData({
            stickyFlag: !1,
            showTop: !1,
            tabCur: 0
        }) : this.setData({
            showTop: !0
        }), a.scrollTop > 200 && a.scrollTop < 340 && this.setData({
            stickyFlag: !0,
            tabCur: 0
        }), a.scrollTop > 340 && a.scrollTop < 460 ? this.data.showStraightInLive ? this.setData({
            tabCur: 1
        }) : this.data.showBuyRecords ? this.setData({
            tabCur: 2
        }) : this.setData({
            tabCur: 3
        }) : a.scrollTop > 460 && a.scrollTop < 720 ? this.data.showStraightInLive ? this.data.showBuyRecords ? this.setData({
            tabCur: 2
        }) : this.setData({
            tabCur: 3
        }) : this.data.showBuyRecords && this.setData({
            tabCur: 3
        }) : a.scrollTop > 720 && this.setData({
            tabCur: 3
        });
    },
    returnTop: function() {
        this.setData({
            stickyFlag: !1
        }), wx.pageScrollTo({
            scrollTop: 0
        });
    },
    timeFormat: function(a) {
        return a < 10 ? "0" + a : a;
    },
    countDown: function() {
        var a = new Date().getTime(), t = [];
        if ("curgoods" == this.data.mscur) e = 1e3 * parseInt(this.data.endTime); else if ("aftergoods" == this.data.mscur) e = 1e3 * parseInt(this.data.endTime); else var e = 1e3 * parseInt(this.data.endTime);
        var o = null;
        if (e - a > 0) {
            var i = (e - a) / 1e3, s = parseInt(i / 86400), d = parseInt(i % 86400 / 3600), n = parseInt(i % 86400 % 3600 / 60), l = parseInt(i % 86400 % 3600 % 60);
            o = {
                day: s,
                hou: this.timeFormat(d),
                min: this.timeFormat(n),
                sec: this.timeFormat(l)
            };
        } else o = {
            day: "00",
            hou: "00",
            min: "00",
            sec: "00"
        };
        t.push(o), this.setData({
            countDownList: t
        }), setTimeout(this.countDown, 1e3);
    },
    add: function(a) {
        console.log(a);
        var t = this, e = (t.data.info, a.currentTarget.dataset.limit), o = a.currentTarget.dataset.stock, s = t.data.curGoodsNum, d = Math.min(parseInt(e), parseInt(o));
        e = parseInt(e), o = parseInt(o), s = parseInt(s);
        var n = a.currentTarget.dataset.id, l = a.currentTarget.dataset.atid, r = {
            gid: n,
            num: 1,
            openid: wx.getStorageSync("openid"),
            at_id: l
        };
        if (s < d && e > 0) ; else if (s < o && 0 == e) ; else {
            if (s >= e) return console.log(e, s), void wx.showToast({
                title: "商品限购" + e + "件哦",
                icon: "none",
                duration: 2e3
            });
            if (s >= o) return void wx.showToast({
                title: "商品数量没有那么多了",
                icon: "none",
                duration: 2e3
            });
        }
        i.CheckGoods({
            id: t.data.info.g_id
        }).then(function(a) {
            console.log(t.data.info.g_id), 1 == a.errno && wx.showToast({
                title: res.message,
                icon: "none"
            }), 0 == a.errno && i.addCart(r).then(function(a) {
                console.log(a), 0 == a.errno ? (t.successtip(), t.setData({
                    carnum: parseInt(a.data.count),
                    curGoodsNum: parseInt(t.data.curGoodsNum) + 1
                }), console.log(t.data.curGoodsNum), wx.setStorageSync("cartnum", parseInt(a.data.count)), 
                0 != a.data.count ? (wx.showTabBarRedDot({
                    index: 2
                }), wx.setTabBarBadge({
                    index: 2,
                    text: a.data.count + ""
                })) : wx.hideTabBarRedDot({
                    index: 2
                })) : wx.showToast({
                    title: a.message,
                    icon: "none",
                    duration: 2e3
                });
            });
        });
    },
    addSpec: function(a) {
        var t = this, e = d.globalData.openid, o = a.currentTarget.dataset.id, s = (a.currentTarget.dataset.atid, 
        t.data.info);
        if (console.log(e), t.setData({
            buyIntime: ""
        }), "spike" == t.data.resource) {
            if (data.num > t.data.info.maxbuy) return void wx.showToast({
                title: "每单限购" + t.data.info.maxbuy + "份",
                duration: 2e3,
                icon: "none"
            });
            i.Seckill_GetSpecInfo({
                openid: e,
                id: o
            }).then(function(a) {
                console.log(a);
            });
        } else {
            if (0 != parseInt(s.g_limit_num) && parseInt(t.data.curGoodsNum) >= parseInt(s.g_limit_num)) return void wx.showToast({
                title: "本商品限购" + s.g_limit_num + "件",
                icon: "none",
                duration: 2e3
            });
            i.GetSpecInfo({
                openid: e,
                id: o
            }).then(function(a) {
                if (console.log(a), 0 == a.errno) {
                    var o = [], s = [];
                    console.log(a.data.spec);
                    for (var d in a.data.spec) {
                        var n = [], l = [];
                        s[d] = {
                            id: a.data.spec[d].id,
                            subSpec: a.data.spec[d].item[0].gsi_id
                        };
                        for (var r in a.data.spec[d].item) n[r] = a.data.spec[d].item[r].gsi_title, l[r] = a.data.spec[d].item[r].gsi_id;
                        o[d] = {
                            id: a.data.spec[d].id,
                            name: a.data.spec[d].title,
                            stem: n,
                            stem_id: l
                        };
                    }
                    for (var c = "", d = s.length - 1; d >= 0; d--) c += "," + s[d].subSpec;
                    i.GetSpecDeatail({
                        openid: e,
                        id_str: c,
                        gid: a.data.goods.g_id
                    }).then(function(e) {
                        if (console.log(e), 0 == e.errno) {
                            var i = e.data.ggo_market_price.split("."), d = a.data.goods.g_limit_num <= 0 ? e.data.ggo_stock : parseInt(a.data.goods.g_limit_num) < parseInt(e.data.ggo_stock) ? a.data.goods.g_limit_num : e.data.ggo_stock, n = {
                                id: a.data.goods.g_id,
                                name: a.data.goods.g_name,
                                photo: a.data.goods.g_icon,
                                specInfo: e.data.ggo_title,
                                price: i,
                                oldPrice: e.data.ggo_old_price,
                                num: 1,
                                popup: o,
                                count: e.data.ggo_stock,
                                limit: d,
                                is_limit: a.data.goods.g_limit_num,
                                ggo_id: e.data.ggo_id
                            };
                            console.log(n.limit), t.setData({
                                specDetail: n,
                                specShow: !t.data.specShow,
                                specDefault: s
                            });
                        } else wx.showToast({
                            title: a.message,
                            icon: "none"
                        });
                    });
                } else wx.showToast({
                    title: a.message,
                    icon: "none"
                });
            });
        }
    },
    popup: function(a) {
        console.log(d.globalData.openid);
        for (var t = this, e = a.currentTarget.dataset.id, o = a.currentTarget.dataset.subid, s = t.data.specDefault, n = "", l = s.length - 1; l >= 0; l--) s[l].id == e && (s[l].subSpec = o, 
        t.setData({
            specDefault: s
        })), n += "," + s[l].subSpec;
        var r = d.globalData.openid, c = t.data.specDetail;
        "spike" == t.data.resource ? i.Seckill_GetSpecDeatail({
            openid: r,
            id_str: n,
            gid: c.id
        }).then(function(a) {
            if (console.log(a), 0 == a.errno) {
                if (1 == a.data.is_seckill) {
                    var e = a.data.price.split("."), o = a.data.maxbuy <= 0 ? a.data.total : parseInt(a.data.maxbuy) < parseInt(a.data.total) ? a.data.maxbuy : a.data.total;
                    t.setData({
                        is_seckill: 1
                    });
                } else {
                    var e = a.data.ggo_market_price.split("."), o = c.is_limit <= 0 ? a.data.ggo_stock : parseInt(c.is_limit) < parseInt(a.data.ggo_stock) ? c.is_limit : a.data.ggo_stock;
                    t.setData({
                        is_seckill: 0
                    });
                }
                console.log(t.data.is_seckill), c.specInfo = a.data.ggo_title, c.price = e, c.oldPrice = a.data.ggo_old_price, 
                c.count = a.data.total, c.limit = o, c.ggo_id = a.data.ggo_id, c.num = 1, t.setData({
                    specDetail: c
                });
            } else wx.showToast({
                title: res.message,
                icon: "none"
            });
        }) : i.GetSpecDeatail({
            openid: r,
            id_str: n,
            gid: c.id
        }).then(function(a) {
            if (0 == a.errno) {
                var e = a.data.ggo_market_price.split("."), o = c.is_limit <= 0 ? a.data.ggo_stock : parseInt(c.is_limit) < parseInt(a.data.ggo_stock) ? c.is_limit : a.data.ggo_stock;
                c.specInfo = a.data.ggo_title, c.price = e, c.oldPrice = a.data.ggo_old_price, c.count = a.data.ggo_stock, 
                c.limit = o, c.ggo_id = a.data.ggo_id, t.setData({
                    specDetail: c
                });
            } else wx.showToast({
                title: res.message,
                icon: "none"
            });
        });
    },
    onChange: function(a) {
        this.setData({
            "choose.num": a.detail
        });
    },
    specOnChange: function(a) {
        var t = a.detail, e = this, o = e.data.specDetail;
        o.num = t, e.setData({
            specDetail: o
        });
    },
    specAddCart: function(a) {
        var t = this, e = a.currentTarget.dataset.id, o = a.currentTarget.dataset.optionid, s = a.currentTarget.dataset.num, n = a.currentTarget.dataset.atid;
        t.data.info;
        i.SpecAddCart({
            openid: d.globalData.openid,
            gid: e,
            ggoid: o,
            num: s,
            at_id: n
        }).then(function(a) {
            0 == a.errno ? (t.successtip(), wx.setStorage({
                key: "cartnum",
                data: parseInt(a.data.count)
            }), 0 != a.data.count ? (wx.showTabBarRedDot({
                index: 2
            }), wx.setTabBarBadge({
                index: 2,
                text: a.data.count + ""
            })) : wx.hideTabBarRedDot({
                index: 2
            }), t.setData({
                specShow: !1,
                curGoodsNum: parseInt(t.data.curGoodsNum) + 1
            })) : wx.showToast({
                title: a.message,
                icon: "none",
                duration: 2e3
            });
        });
    },
    buy: function(a) {
        var t = this;
        if (1 == d.globalData.is_first_enter) {
            var e = "back";
            return e = encodeURIComponent(e), wx.navigateTo({
                url: "/pages/authorization/authorization?url=" + e
            }), !1;
        }
        var o = t.data.info, s = t.data.show;
        if (console.log(a, s), s) {
            if (console.log(s), "spike" == t.data.resource) {
                if (console.log(t.data.maxbuy, t.data.total), 0 != t.data.maxbuy && t.data.maxbuy > t.data.total) u = !1;
                if (0 != t.data.maxbuy && t.data.maxbuy < t.data.total) u = !0;
                if (0 == t.data.maxbuy) u = !0;
                n = {
                    gid: t.data.info.goodsid,
                    num: t.data.choose.num,
                    openid: d.globalData.openid,
                    timeid: t.data.info.timeid,
                    roomid: t.data.info.roomid,
                    taskid: t.data.info.taskid,
                    spshow: u
                };
                console.log(n);
            } else {
                if (0 != t.data.g_limit_num && t.data.g_limit_num > t.data.actual) u = !1;
                if (0 != t.data.g_limit_num && t.data.g_limit_num < t.data.actual) u = !0;
                if (0 == t.data.g_limit_num) u = !0;
                var n = {
                    gid: t.data.info.g_id,
                    num: t.data.choose.num,
                    openid: d.globalData.openid,
                    at_id: t.data.at_id,
                    price: t.data.info.g_price,
                    spshow: u
                };
            }
            i.CheckGoods({
                id: t.data.info.g_id
            }).then(function(a) {
                if (console.log(a), 1 == a.errno && wx.showToast({
                    title: a.message,
                    icon: "none"
                }), 0 == a.errno) {
                    var e = JSON.stringify(n);
                    wx.navigateTo({
                        url: "/pages/checkout/detailCheckout?data=" + e + "&&resource=" + t.data.resource
                    });
                }
            });
        }
        if ("spike" == t.data.resource) {
            console.log(o.maxbuy, o.total);
            var l = parseInt(o.maxbuy), r = parseInt(o.total);
            if (0 != l && l >= r) u = !0;
            if (0 != l && l < r) u = !1;
            if (0 == l) u = !0;
        } else {
            console.log(o, o.g_limit_num, o.actual);
            var c = parseInt(o.g_limit_num), g = parseInt(o.actual);
            if (0 != c && c >= g) u = !0;
            if (0 != c && c < g) u = !1;
            if (0 == c) var u = !0;
        }
        t.setData({
            show: !0,
            spShow: u
        });
    },
    onClick: function() {
        console.log(1111);
    },
    buyIntime: function(a) {
        var t = this;
        if ("spike" == t.data.resource) if (console.log(t.data.info, t.data.is_seckill), 
        1 == t.data.is_seckill) {
            o = {
                gid: t.data.info.g_id,
                num: t.data.specDetail.num,
                openid: d.globalData.openid,
                ggo_id: t.data.specDetail.ggo_id,
                ggo_title: t.data.specDetail.specInfo,
                timeid: t.data.info.timeid,
                roomid: t.data.info.roomid,
                taskid: t.data.info.taskid
            };
            console.log(o);
            var e = JSON.stringify(o);
            wx.navigateTo({
                url: "/pages/checkout/detailCheckout?data=" + e + "&&resource=spike"
            });
        } else {
            o = {
                gid: t.data.info.g_id,
                num: t.data.specDetail.num,
                openid: d.globalData.openid,
                at_id: t.data.at_id,
                price: t.data.specDetail.price[0] + "." + t.data.specDetail.price[1],
                ggo_id: t.data.specDetail.ggo_id,
                ggo_title: t.data.specDetail.specInfo
            };
            console.log(o), i.CheckGoods({
                id: t.data.info.g_id
            }).then(function(a) {
                if (1 == a.errno && wx.showToast({
                    title: a.message,
                    icon: "none"
                }), 0 == a.errno) {
                    var t = JSON.stringify(o);
                    console.log(t), wx.navigateTo({
                        url: "/pages/checkout/detailCheckout?data=" + t
                    });
                }
            });
        } else {
            var o = {
                gid: t.data.info.g_id,
                num: t.data.specDetail.num,
                openid: d.globalData.openid,
                at_id: t.data.at_id,
                price: t.data.specDetail.price[0] + "." + t.data.specDetail.price[1],
                ggo_id: t.data.specDetail.ggo_id,
                ggo_title: t.data.specDetail.specInfo
            };
            console.log(o), i.CheckGoods({
                id: t.data.info.g_id
            }).then(function(a) {
                if (1 == a.errno && wx.showToast({
                    title: a.message,
                    icon: "none"
                }), 0 == a.errno) {
                    var t = JSON.stringify(o);
                    wx.navigateTo({
                        url: "/pages/checkout/detailCheckout?data=" + t
                    });
                }
            });
        }
    },
    buySpec: function(a) {
        var t = this, e = d.globalData.openid, o = a.currentTarget.dataset.id;
        console.log(o), "spike" == t.data.resource ? i.Seckill_GetSpecInfo({
            openid: e,
            id: o
        }).then(function(a) {
            if (console.log(a), 0 == a.errno) {
                var o = [], s = [];
                console.log(a.data.spec);
                for (var d in a.data.spec) {
                    var n = [], l = [];
                    s[d] = {
                        id: a.data.spec[d].id,
                        subSpec: a.data.spec[d].item[0].gsi_id
                    };
                    for (var r in a.data.spec[d].item) n[r] = a.data.spec[d].item[r].gsi_title, l[r] = a.data.spec[d].item[r].gsi_id;
                    o[d] = {
                        id: a.data.spec[d].id,
                        name: a.data.spec[d].title,
                        stem: n,
                        stem_id: l
                    };
                }
                console.log(1);
                for (var c = "", d = s.length - 1; d >= 0; d--) c += "," + s[d].subSpec;
                i.Seckill_GetSpecDeatail({
                    openid: e,
                    id_str: c,
                    gid: a.data.goods.g_id
                }).then(function(e) {
                    if (console.log(e), 0 == e.errno) {
                        if (1 == e.data.is_seckill) {
                            var i = e.data.price.split("."), d = e.data.maxbuy <= 0 ? e.data.total : parseInt(e.data.maxbuy) < parseInt(e.data.total) ? e.data.maxbuy : e.data.total;
                            t.setData({
                                is_seckill: 1
                            });
                        } else {
                            var i = e.data.ggo_market_price.split("."), d = a.data.goods.g_limit_num <= 0 ? e.data.ggo_stock : parseInt(a.data.goods.g_limit_num) < parseInt(e.data.ggo_stock) ? a.data.goods.g_limit_num : e.data.ggo_stock;
                            t.setData({
                                is_seckill: 0
                            });
                        }
                        console.log(t.data.is_seckill);
                        var n = {
                            id: a.data.goods.g_id,
                            name: a.data.goods.g_name,
                            photo: a.data.goods.g_icon,
                            specInfo: e.data.ggo_title,
                            price: i,
                            oldPrice: e.data.ggo_old_price,
                            num: 1,
                            popup: o,
                            count: e.data.total,
                            limit: d,
                            is_limit: a.data.goods.g_limit_num,
                            ggo_id: e.data.ggo_id
                        };
                        t.setData({
                            specDetail: n,
                            specShow: !t.data.specShow,
                            specDefault: s,
                            buyIntime: "buyIntime"
                        });
                    } else wx.showToast({
                        title: a.message,
                        icon: "none"
                    });
                });
            } else wx.showToast({
                title: a.message,
                icon: "none"
            });
        }) : i.GetSpecInfo({
            openid: e,
            id: o
        }).then(function(a) {
            if (0 == a.errno) {
                var o = [], s = [];
                console.log(a.data.spec);
                for (var d in a.data.spec) {
                    var n = [], l = [];
                    s[d] = {
                        id: a.data.spec[d].id,
                        subSpec: a.data.spec[d].item[0].gsi_id
                    };
                    for (var r in a.data.spec[d].item) n[r] = a.data.spec[d].item[r].gsi_title, l[r] = a.data.spec[d].item[r].gsi_id;
                    o[d] = {
                        id: a.data.spec[d].id,
                        name: a.data.spec[d].title,
                        stem: n,
                        stem_id: l
                    };
                }
                for (var c = "", d = s.length - 1; d >= 0; d--) c += "," + s[d].subSpec;
                i.GetSpecDeatail({
                    openid: e,
                    id_str: c,
                    gid: a.data.goods.g_id
                }).then(function(e) {
                    if (console.log(e), 0 == e.errno) {
                        var i = e.data.ggo_market_price.split("."), d = a.data.goods.g_limit_num <= 0 ? e.data.ggo_stock : parseInt(a.data.goods.g_limit_num) < parseInt(e.data.ggo_stock) ? a.data.goods.g_limit_num : e.data.ggo_stock, n = {
                            id: a.data.goods.g_id,
                            name: a.data.goods.g_name,
                            photo: a.data.goods.g_icon,
                            specInfo: e.data.ggo_title,
                            price: i,
                            oldPrice: e.data.ggo_old_price,
                            num: 1,
                            popup: o,
                            count: e.data.ggo_stock,
                            limit: d,
                            is_limit: a.data.goods.g_limit_num,
                            ggo_id: e.data.ggo_id
                        };
                        t.setData({
                            specDetail: n,
                            specShow: !t.data.specShow,
                            specDefault: s,
                            buyIntime: "buyIntime"
                        });
                    } else wx.showToast({
                        title: a.message,
                        icon: "none"
                    });
                });
            } else wx.showToast({
                title: a.message,
                icon: "none"
            });
        });
    }
}, a(e, "onPageScroll", function(a) {
    var t = this, e = a.scrollTop;
    e < 222 && t.setData({
        showTop: !0
    }), e >= 222 && e < 484 && t.setData({
        showTop: !1,
        tabCur: 0
    }), e >= 484 && e < 913 && t.setData({
        showTop: !1,
        tabCur: 2
    }), e >= 913 && t.setData({
        showTop: !1,
        tabCur: 3
    });
}), a(e, "groupBuy", function(a) {
    this.setData({
        groupBuyShow: !0
    });
}), a(e, "groupCloseButton", function() {
    this.setData({
        groupBuyShow: !1
    });
}), a(e, "stop", function() {}), a(e, "playvideo", function(a) {
    console.log(a);
    var t = a.currentTarget.dataset.url;
    wx.navigateTo({
        url: "/pages/goods/video?url=" + t + "&&resource=1"
    });
}), a(e, "closevideo", function(a) {
    console.log(a), this.setData({
        showVideo: !1
    });
}), a(e, "roundRectColor", function(a, t, e, o, i, s) {
    a.save(), a.setFillStyle("#ff4848"), a.setStrokeStyle("#ff4848"), a.setLineJoin("round"), 
    a.setLineWidth(s), a.strokeRect(t + s / 2, e + s / 2, o - s, i - s), a.fillRect(t + s, e + s, o - 2 * s, i - 2 * s), 
    a.stroke(), a.closePath(), a.restore();
}), a(e, "drawweixinposter", function(a, t) {
    var e = this, o = e.data.info, i = wx.createCanvasContext("weixinCanvasPoster"), s = parseFloat(this.data.systemWidth / 375);
    s /= 2, console.log(e.data.WeixinPosterBg), i.drawImage(t, 0, 0, 636 * s, 508 * s), 
    i.drawImage(a, 44 * s, 84 * s, 300 * s, 300 * s);
    var d = "距结束" + e.data.countDownList[0].day + "天 " + e.data.countDownList[0].hou + ":" + e.data.countDownList[0].min + ":" + e.data.countDownList[0].sec;
    i.setFillStyle("#ffffff"), i.setFontSize(26 * s), i.fillText(d, 200 * s, 36 * s), 
    i.setFillStyle("#ed3a34"), i.font = "normal bold 19px 微软雅黑", i.fillText("抢购价", 380 * s, 146 * s), 
    i.font = "normal normal 15px 微软雅黑", i.fillText("¥", 380 * s, 220 * s), i.font = "normal bold 30px 微软雅黑";
    var n = parseFloat(i.measureText(o.priceArry[0]).width);
    i.fillText(o.priceArry[0], 404 * s, 220 * s), i.setFontSize(30 * s), i.fillText("." + o.priceArry[1], 404 * s + n, 220 * s);
    var l = "市场价¥" + o.g_old_price;
    i.font = "normal normal 12px 微软雅黑", i.setFillStyle("#9a9a9a");
    var r = parseFloat(i.measureText(l).width);
    i.fillText(l, 380 * s, 266 * s), i.setStrokeStyle("#9a9a9a"), i.setLineWidth(1 * s), 
    i.moveTo(380 * s, 266 * s - 6 * s), i.lineTo(380 * s + r, 266 * s - 6 * s), i.drawImage("/images/qianggou.png", 380 * s, 311 * s, 224 * s, 62 * s), 
    i.fill(), i.stroke(), setTimeout(function() {}), i.draw(!1, function() {
        console.log("aa"), wx.canvasToTempFilePath({
            x: 0,
            y: 0,
            width: parseFloat(636 * s),
            height: parseFloat(508 * s),
            destWidth: parseFloat(636 * s),
            destHeight: parseFloat(508 * s),
            canvasId: "weixinCanvasPoster",
            fileType: "png",
            quality: 1,
            success: function(a) {
                e.setData({
                    weixinShareImage: a.tempFilePath,
                    canvasHidden: !0
                }), console.log(a.tempFilePath);
            },
            fail: function(a) {
                console.log(a), wx.hideLoading();
            }
        });
    });
}), a(e, "drawposter", function(a, t, e) {
    var o = this, i = o.data.info, s = o.data.systemWidth / 750, d = wx.createCanvasContext("showposter");
    d.drawImage(e, 0, 0, 540 * s, 924 * s), d.drawImage(a, 72 * s, 174 * s, 400 * s, 400 * s), 
    d.drawImage(t, 390 * s, 708 * s, 110 * s, 110 * s), d.setFontSize(20 * s * 2), d.setFillStyle("#eb0208"), 
    d.fillText("￥", 42 * s, 684 * s), d.setFontSize(30 * s * 2);
    var n = parseFloat(d.measureText(i.priceArry[0]).width);
    d.fillText(i.priceArry[0], 80 * s, 684 * s), d.setFontSize(20 * s * 2);
    var l = parseFloat(d.measureText(i.priceArry[1]).width);
    d.fillText("." + i.priceArry[1], 80 * s + n, 684 * s), d.setFillStyle("#686868"), 
    d.setFontSize(16 * s * 2);
    var r = parseFloat(d.measureText("￥" + i.g_old_price).width);
    d.fillText("￥" + i.g_old_price, 80 * s + n + l + 10 * s, 684 * s), d.setFontSize(8 * s * 2), 
    d.setFillStyle("#4f4f4f"), d.fillText("长按识别抢购", 400 * s, 840 * s), d.setFillStyle("#454545");
    var c = d;
    d.font = "normal bold 16px 微软雅黑";
    for (var g = i.g_name, u = 772 * s, p = 280 * s, m = 0, _ = 0, h = 0, f = 0; f < g.length; f++) {
        if (m += c.measureText(g[f]).width, console.log(m, p), m > p) {
            if (2 == ++h) {
                c.fillText(g.substring(_, f - 2) + "...", 46 * s, u);
                break;
            }
            c.fillText(g.substring(_, f), 46 * s, u), u += 24, m = 0, _ = f;
        }
        f == g.length - 1 && c.fillText(g.substring(_, f + 1), 46 * s, u);
    }
    d.setStrokeStyle("#686868"), d.moveTo(90 * s + n + l + 10 * s, 670 * s), d.lineTo(90 * s + n + l + r, 670 * s), 
    d.restore(), d.closePath(), d.stroke(), o.setData({
        showposter: !1
    }), d.draw(!1, function() {
        setTimeout(function() {
            wx.canvasToTempFilePath({
                x: 0,
                y: 0,
                width: parseFloat(540 * s),
                height: parseFloat(924 * s),
                destWidth: parseFloat(540 * s * 2.5),
                destHeight: parseFloat(924 * s * 2.5),
                canvasId: "showposter",
                fileType: "png",
                quality: 1,
                success: function(a) {
                    console.log(a), o.setData({
                        shareImage: a.tempFilePath
                    }), wx.hideLoading(), console.log(a.tempFilePath);
                },
                fail: function(a) {
                    console.log(a), wx.hideLoading();
                }
            });
        }, 200);
    });
}), a(e, "savecanvas", function() {
    var a = this;
    a.setData({
        saveImg: !0
    }), setTimeout(function() {
        a.setData({
            saveImg: !1
        });
    }, 3e3), wx.getSetting({
        success: function(t) {
            t.authSetting["scope.writePhotosAlbum"] ? (console.log(3), wx.saveImageToPhotosAlbum({
                filePath: a.data.shareImage,
                success: function() {
                    wx.showToast({
                        title: "保存成功"
                    });
                },
                fail: function() {
                    wx.showToast({
                        title: "保存失败",
                        icon: "none"
                    });
                },
                complete: function() {
                    a.setData({
                        showposter: !0
                    });
                }
            })) : (console.log(1), wx.authorize({
                scope: "scope.writePhotosAlbum",
                success: function() {
                    wx.saveImageToPhotosAlbum({
                        filePath: a.data.shareImage,
                        success: function() {
                            wx.showToast({
                                title: "保存成功"
                            });
                        },
                        fail: function() {
                            wx.showToast({
                                title: "保存失败",
                                icon: "none"
                            });
                        },
                        complete: function() {
                            a.setData({
                                showposter: !0
                            });
                        }
                    });
                },
                fail: function() {
                    console.log(2), a.setData({
                        openSet: !0
                    });
                }
            }));
        }
    });
}), a(e, "closeposter", function() {
    this.setData({
        showposter: !0
    });
}), a(e, "stopscorll", function() {}), a(e, "imgload", function(a) {
    console.log(a);
    var t = this, e = a.currentTarget.dataset.data_index, o = t.data.systemWidth, i = a.detail.width, s = a.detail.height * o / a.detail.width;
    console.log(o, i, s, a.detail.height);
    var d = this.data.imgHeights;
    d[e] = s, t.setData({
        imgHeights: d
    });
}), a(e, "successtip", function() {
    arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
    var t = this;
    t.setData(a({}, "showSuccesstipInfo.showSuccesstip", !t.data.showSuccesstipInfo.showSuccesstip)), 
    setTimeout(function() {
        t.setData(a({}, "showSuccesstipInfo.showSuccesstip", !t.data.showSuccesstipInfo.showSuccesstip));
    }, 1300);
}), a(e, "buySeckill", function(a) {
    console.log(a);
    var t = this, e = {
        openid: d.globalData.openid,
        taskid: t.data.parmas.taskid,
        roomid: t.data.parmas.roomid,
        timeid: t.data.parmas.timeid,
        gid: t.data.parmas.timeid
    };
    i.Seckill_get_goods(e).then(function() {});
}), a(e, "getcoupon", function(a) {}), a(e, "closelist", function() {
    this.setData({
        closeList: !1
    });
}), a(e, "maxLimit", function(a) {
    var t = this;
    console.log(a);
    var e = a.currentTarget.dataset.max;
    t.data.spShow ? t.showtips({
        title: "商品数量没有那么多了",
        duration: 2e3
    }) : t.showtips({
        title: "商品限购" + e + "件哦",
        duration: 2e3
    });
}), a(e, "overlimit", function(a) {
    var t = this;
    console.log(a, t.data.spShow);
    var e = a.currentTarget.dataset.max;
    t.data.spShow ? t.showtips({
        title: "商品限购" + e + "件哦",
        duration: 2e3
    }) : t.showtips({
        title: "商品数量没有那么多了",
        duration: 2e3
    });
}), a(e, "showtips", function(a) {
    var t = this, e = a.title, o = a.duration ? a.duration : null;
    console.log(e, o);
    i = {
        title: e,
        duration: null == o ? null : o,
        show: !0
    };
    if (t.setData({
        limitTips: i
    }), null != o) {
        var i = {
            title: "",
            duration: 2e3,
            show: !1
        };
        setTimeout(function() {
            t.setData({
                limitTips: i
            });
        }, o);
    }
}), a(e, "hidetips", function() {
    var a = {
        title: "",
        duration: 2e3,
        show: !1
    };
    this.setData({
        limitTips: a
    });
}), a(e, "measureTexts", function(a, t) {
    var e = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 10;
    if (a.measureText(t)) {
        var o = 0;
        return (t = (t = String(t)).split("")).forEach(function(a) {
            /[a-zA-Z]/.test(a) ? o += 7 : /[0-9]/.test(a) ? o += 5.5 : /\./.test(a) ? o += 2.7 : /-/.test(a) ? o += 3.25 : /[\u4e00-\u9fa5]/.test(a) ? o += 10 : /\(|\)/.test(a) ? o += 3.73 : /\s/.test(a) ? o += 2.5 : /%/.test(a) ? o += 8 : o += 10;
        }), o * e / 10;
    }
    return a.measureText(t).width;
}), e));